<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .div1{
            width: 100px;
            height: 100px;
            border: 1px solid black;
            padding: 10px;
            margin: 10px;
        }
    </style>
</head>
<body>
    <!-- 求offsetWidth的宽度 -->
    <div class="div1">
        this is a div
    </div>
    </div>
    <script>
        console.log(document.querySelector('.div1').offsetWidth);
    </script>
</body>
</html>